package com.work.formaldehyde.activityadapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.work.formaldehyde.R;

import java.util.ArrayList;

public class CityCheckAdapter extends BaseAdapter {
    ArrayList<String> list;
    Context context;
    boolean ok;

    public CityCheckAdapter(ArrayList<String> list, Context context, boolean ok) {
        // TODO Auto-generated constructor stub
        this.list = list;
        this.context = context;
        this.ok = ok;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return list != null ? list.size() : 0;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return list != null ? list.get(position) : 0;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        convertView = LayoutInflater.from(context).inflate(R.layout.city_check_item, null);
        init i = new init();
        i.check_text = convertView.findViewById(R.id.check_text);
        i.check_text.setText(list.get(position));
        convertView.setTag(i);
        return convertView;
    }

    public static class init {
        //首页list的子控件
        TextView check_text;
    }
}

